package com.example.code_school.service.impl;

import com.example.code_school.entity.Student;
import com.example.code_school.mapper.StudentMapper;
import com.example.code_school.service.StudentService;
import com.example.code_school.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    StudentMapper studentMapper;

    @Override
    public List<Student> getStudents(String sname,Long gid,Integer pageIndex) {


        Integer startNum=(pageIndex-1)* PageUtil.PAGESIZE;
        return studentMapper.getStudents(sname,gid,startNum,PageUtil.PAGESIZE);

    }

    @Override
    public Integer getStudentsCount(String sname, Long gid) {
        return studentMapper.getStudentsCount(sname,gid);
    }
}
